public class Calculator {
    String color, brand;
    double price;

    public void show() {
        System.out.println("颜色" + color + "元");
        System.out.println("品牌" + brand);
        System.out.println("价格" + price);
        System.out.println("计算器开始运行：");
    }

    public double add(double num1, double num2) {
        return (num1 + num2);
    }

    public double sub(double num1, double num2) {
        return (num1 - num2);
    }

    public double mul(double num1, double num2) {
        return (num1 * num2);
    }

    public double div(double num1, double num2) {
        if (num2 == 0) {
            System.out.println("除数不能为0，错误");
        }
        return (num1 / num2);
    }

    public double cube(double num) {
        return (num * num * num);
    }
}
//4:计算器用颜色，品牌，价格等属性，有计算加减乘除以及算一个数立方的方法，
// 用oo的思想模拟（提示，计算立方只要一个参数）。
public class Oopzy02 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        Calculator ca = new Calculator();
        ca.color = "黑色";
        ca.brand = "卡西欧";
        ca.price = 123;
        ca.show();
        System.out.println(ca.add(1, 2));
        System.out.println(ca.sub(1, 2));
        System.out.println(ca.mul(1, 2));
        System.out.println(ca.div(1, 2));
        System.out.println(ca.cube(3));
    }
}